
export const seachConfig = () => {
  return [
    {
      key: 'name',
      label: '班级名称'
    }
  ]
}

export const columnConfig = [
  {
    prop: 'name',
    label: '班级名称'
  },
  {
    prop: 'inChargeTeacherName',
    label: '班主任'
  },
  {
    prop: 'beginMonth',
    label: '适用月龄',
    align: 'center'
  },
  {
    prop: 'studentNum',
    label: '班级人数',
    align: 'center'
  },
  {
    prop: 'remark',
    label: '备注'
  },
  {
    prop: 'action',
    label: '操作',
    width: '146',
    align: 'center'
  }
]

export const addConfig = ({ baseData }) => {
  console.log(baseData)
  return [
    {
      key: 'name',
      label: '班级名称',
      layoutCol: { sm: 24, md: 14, lg: 12 },
      rules: [{ required: true, message: '请输入' }],
      initialValue: baseData?.name
      // fieldProps: {
      //   style: { width: '240px' }
      // }
    },
    {
      key: 'category',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      type: 'radio',
      label: '班级类型',
      rules: [{ required: true, message: '请选择' }],
      initialValue: String(baseData?.category) || '1',
      fieldProps: {
        dictKey: 'classCategory',
        props: { value: 'value', label: 'label' }
      }
    },
    {
      key: 'targetObjectId',
      layoutCol: { sm: 24, md: 14, lg: 12 },
      type: 'select',
      label: '托班类型',
      hidden: val => {
        console.log(val)
        return val.category !== '1'
      },
      rules: [{ required: true, message: '请选择' }],
      initialValue: baseData?.targetObjectId,
      fieldProps: {
        dictKey: 'nurseryClassTypes',
        props: { label: 'label' },
        dictParams: {
          cb: val => {
            return (val || []).map(x => {
              x.label = `${x.name}(${x.description})`
              return x
            })
          }
        }
      }
    },
    {
      key: 'monthRange',
      type: 'slot',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '适用月龄',
      rules: [{ required: true, message: '请输入' }],
      initialValue: `${baseData?.beginMonth} ~ ${baseData?.endMonth}`
    },
    {
      key: 'limitNum',
      type: 'number',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '满额人数',
      rules: [{ required: true, message: '请输入' }],
      initialValue: baseData?.limitNum
    },
    {
      key: 'teachingAreaIds',
      type: 'slot',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '教学区域',
      rules: [{ required: true, message: '请输入' }],
      initialValue: baseData?.teachingAreaIds
    },
    {
      key: 'remark',
      type: 'textarea',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '备注',
      rules: [{ required: true, message: '请输入' }],
      initialValue: baseData?.remark
    },
    {
      key: 'inChargeTeacherId',
      type: 'slot',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '班主任',
      rules: [{ required: true, message: '请输入' }]
    },
    {
      key: 'teacherIds',
      type: 'slot',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '老师'
    },
    {
      key: 'doctorIds',
      type: 'slot',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '儿保医生'
    },
    {
      key: 'childrenIds',
      type: 'slot',
      layoutCol: { sm: 24, md: 24, lg: 24 },
      label: '宝宝'
    }
  ]
}
